{extend name="template/base" /}
{block name="content"}
<div class="page-container">

    <div class="cl pd-5 bg-1 bk-gray">
         <span class="l">
             {tp:access action="add"}
                 <a class="btn btn-primary radius mr-5" href="javascript:;" onclick="layer_open('新增','/admin/task/add.html')"><i class="Hui-iconfont"></i> 新增</a>
             {/tp:access}
         </span>
    </div>
    <div class="cl pd-5 bg-1 bk-gray">
         <span class="r">
             <span class="r"> 共有数据 ：<strong>{$count}</strong> 条</span>
         </span>
    </div>
    <table class="table table-border table-bordered table-hover table-bg mt-20">
        <thead>
        <tr class="text-c">
            <th >编号</th>
            <th >标题</th>
            <th >内容</th>
            <th >图标</th>
            <th >类型</th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="list" id="vo"}
        <tr class="text-c">
            <td>{$vo.id}</td>
            <td>{$vo.title}</td>
            <td width="240">{$vo.content}</td>
            <td><img src="{$vo.img}" width="60" height="60"></td>
            <td>{if condition="$vo.type eq 1"}APP{else/}浏览器{/if}</td>
            <td class="f-14">
                {tp:access action="edit"}
                <a class="label btn-success radius" style="background-color:#5eb95e" href="javascript:;" onclick="layer_open('编辑','{:\\think\\Url::build(\'edit\', [\'id\'=>$vo[\'id\']])}')">编辑</a>
                {/tp:access}
                {tp:access action="delete"}
                <a class="label btn-danger radius" style="background-color:#dd514c" href="javascript:;" onclick="del_alls('{:\\think\\Url::build(\'delete\')}','{$vo.id}')" >删除</a>
                {/tp:access}
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page-bootstrap">{$page}</div>
</div>
<script>
    function del_alls(url, id) {
        layer.confirm('确定要删除吗?', {
            btn: ['确定', '取消'],
            title: '提示',
            icon: 3
        }, function () {
            $.post(url, {id: id}, function (data) {
                if (data.code == 0) {
                    parent.layer.msg(data.msg, {icon: 1, time: 1000});
                    window.location.reload();
                } else {
                    layer.alert(data.msg);
                }
            }, 'json')
        }, function (index) {
            layer.close(index);
        });
    }

</script>
{/block}